export default{
    data() {
      return {
      };
    },
    methods: {
      //箱起商品选择点击，type设置为35
      chooseBoxGoods(){
        let selected = this.data.content_list.filter(item=>item.type===35).map(item => {
          return {
            id: item.id,
            boxId:item.boxId,
            goodsId: item.goodsId,
            image: item.pic,
            name: item.title,
            subTitle: item.subName,
            marketPrice: item.marketValue,
            ordinaryPrice: item.price
          }
        });
        // console.log(selected);
        this.boxGoodChoose({}, selected).then(val => {
          // console.log(val);
          this.data.content_list = this.data.content_list.filter(item=>item.type!==35).concat(val.map(item => {
            return {
              id:item.id,
              goodsId: item.goodsId,
              boxId:item.boxId,
              pic: item.image.includes('?x-oss-process=image/resize') ? item.image : item.image + '?x-oss-process=image/resize,m_fill,h_400,w_400',
              title: item.name,
              subName: item.subTitle,
              price: item.ordinaryPrice,
              marketValue: item.marketPrice,
              type: 35,
            }
          }))
        })
      },
      // chooseBoxGoods(){
      //   let selected = this.data.content_list.filter(item=>item.type===35).map(item => {
      //     return {
      //       id: item.id,
      //       boxId:item.boxId,
      //       goodsId: item.goodsId,
      //       image: item.pic,
      //       name: item.title,
      //       subTitle: item.subName,
      //       marketPrice: item.marketValue,
      //       ordinaryPrice: item.price
      //     }
      //   });
      //   // console.log(selected);
      //   this.$refs.boxGoodChoose.selected=selected;
      //   this.$refs.boxGoodChoose.showTable();
      // },
      // //选择箱起商品
      // box_good_choose(val){
      //   // console.log(val);
      //   this.data.content_list = this.data.content_list.filter(item=>item.type !==35).concat(val.map(item => {
      //     return {
      //       id:item.id,
      //       goodsId: item.goodsId,
      //       boxId:item.boxId,
      //       pic: item.image.includes('?x-oss-process=image/resize') ? item.image : item.image + '?x-oss-process=image/resize,m_fill,h_400,w_400',
      //       title: item.name,
      //       subName: item.subTitle,
      //       price: item.ordinaryPrice,
      //       marketValue: item.marketPrice,
      //       type: 35,
      //     }
      //   }))
      // },
    }
}
